Skip to content

Create plans to arm the fast-cs eiger#1054

Closed
shihab-dls wants to merge 11 commits intomainfrom
eiger_dev_plans
Closed

Create plans to arm the fast-cs eiger#1054
shihab-dls wants to merge 11 commits intomainfrom
eiger_dev_plans

Conversation

@shihab-dls
Copy link
Copy Markdown
Contributor

@shihab-dls shihab-dls commented Feb 10, 2025

Resolves #1053
This PR is not meant to be merged; kept as a draft to monitor changes to the dev branch.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.

Project coverage is 97.20%. Comparing base (65edfe2) to head (173ab0c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/dodal/devices/util/load_eiger_metadata_plan.py 0.00% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1054      +/-   ##
==========================================
- Coverage   97.68%   97.20%   -0.48%     
==========================================
  Files         160      161       +1     
  Lines        6600     6648      +48     
==========================================
+ Hits         6447     6462      +15     
- Misses        153      186      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Couple of comments, I think there are some additional things we need to set too:

  • num_frames_chunks
  • The file name/directory e.g. everything in set_odin_pvs
  • dev_shm

def load_metadata(
eiger: EigerDetector, energy: float, enable: bool, detector_params: DetectorParams
):
def _inner_plan():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: Why do you need an inner plan here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was the first thing I wrote for structure and left in for no reason; removing as definitely not needed :0

Comment on lines +34 to +44
def set_mx_settings_pvs(eiger: EigerDetector, detector_params: DetectorParams):
beam_x_pixels, beam_y_pixels = detector_params.get_beam_position_pixels(
detector_params.detector_distance
)

yield from bps.abs_set(eiger.drv.beam_centre_x, beam_x_pixels)
yield from bps.abs_set(eiger.drv.beam_centre_y, beam_y_pixels)
yield from bps.abs_set(eiger.drv.det_distance, detector_params.detector_distance)

yield from bps.abs_set(eiger.drv.omega_start, detector_params.omega_start)
yield from bps.abs_set(eiger.drv.omega_increment, detector_params.omega_increment)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: We probably want to group these things as it makes it more async (even if Tom/Gary assure us it's instantaneous). Then we will need to wait on them at some point so we should add that optionally too e.g.

Suggested change
def set_mx_settings_pvs(eiger: EigerDetector, detector_params: DetectorParams):
beam_x_pixels, beam_y_pixels = detector_params.get_beam_position_pixels(
detector_params.detector_distance
)
yield from bps.abs_set(eiger.drv.beam_centre_x, beam_x_pixels)
yield from bps.abs_set(eiger.drv.beam_centre_y, beam_y_pixels)
yield from bps.abs_set(eiger.drv.det_distance, detector_params.detector_distance)
yield from bps.abs_set(eiger.drv.omega_start, detector_params.omega_start)
yield from bps.abs_set(eiger.drv.omega_increment, detector_params.omega_increment)
def set_mx_settings_pvs(eiger: EigerDetector, detector_params: DetectorParams, group="mx_settings", wait=True):
beam_x_pixels, beam_y_pixels = detector_params.get_beam_position_pixels(
detector_params.detector_distance
)
yield from bps.abs_set(eiger.drv.beam_centre_x, beam_x_pixels, group)
yield from bps.abs_set(eiger.drv.beam_centre_y, beam_y_pixels, group)
yield from bps.abs_set(eiger.drv.det_distance, detector_params.detector_distance, group)
yield from bps.abs_set(eiger.drv.omega_start, detector_params.omega_start, group)
yield from bps.abs_set(eiger.drv.omega_increment, detector_params.omega_increment, group)
if wait:
yield from bps.wait(group)

This is a pattern we've used in a few places e.g. https://github.com/DiamondLightSource/mx-bluesky/blob/11c8a31f05dfc8421b9ebf205cc49598cd8806be/src/mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py#L58. It allows the caller to have some flexibility in timings.

We should do the same for other plans in this file too

@shihab-dls
Copy link
Copy Markdown
Contributor Author

shihab-dls commented Feb 17, 2025

Currently, this plan does the following arming chain:
change_roi_mode
set_odin_number_of_frame_chunks
set_mx_settings_pvs
Then runs Eiger prepare(), which does:
set_detector_threhold

The following are missing:
change_dev_shm
odin.stop
set_odin_pvs
set_num_triggers_and_captures

change_dev_shm is not included due to limited development/dissemination on the fastcs-eiger/fastcs-odin front, but should not significantly affect timings, and thus does not block testing the arming chain.

I am operating under the assumption set_num_triggers_and_captures is addressed in StandardDetector during prepare(), but will look into this more to check if this is ok.

odin.stop and set_odin_pvs should be looked at.

@shihab-dls
Copy link
Copy Markdown
Contributor Author

Following the last commit, the plan now also includes:
set_odin_pvs

However, this does not set odin.meta.file_name and odin.file_writer.id. This is mainly because of the following comments:
# file_name should not be set. Set the filewriter file_name and this will be updated in EPICS in OdinMetaListener
# id should not be set. Set the filewriter file_name and this will be updated in EPICS in OdinFileWriter
But, this should be checked

odin.stop is also included now, but is done via bps.stage(eiger) as this stops odin file writing and clears trigger info

@shihab-dls
Copy link
Copy Markdown
Contributor Author

This is now being addressed in #1187.

@shihab-dls shihab-dls closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create plans to arm the fast-cs eiger

2 participants